home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Almathera Ten Pack 2: CDPD 1
/
Almathera Ten on Ten - Disc 2: CDPD 1.iso
/
pd
/
076-100
/
092
/
bawk
/
readme
< prev
next >
Wrap
Text File
|
1995-03-13
|
3KB
|
81 lines
Changes as of 19-JUL-1987
I got this code from Fish disk number 65. Although the program is well
written it did not run on the Amiga. I set out to get it running and have
by now, as usual, spent far to much time on it. I release this update in the
hope that someone else will do some work on it.
I going to say a lot of negative things about Bawk here. This should not
taken as critisism against the original author. As I said above the program
was well written and it was fun to work with it. The characteristics of
the original program is 'almost correct, easy to understand, but slow'.
I much prefer to work with such code as compared to 'fast but buggy' code.
Although you may not believe it at first, there is really a lot of
functionality in this program. However; Bawk is not awk. There is a lot of
functionality lacking, and Bawk is also slower. You can be the one to
change all that... 8-)
Here are the some differences between awk and Bawk.
Regular expressions in Bawk are delimited by '@', not '/':
@[Ff]oo@
The function 'print' is not implemented. You have to get by with 'printf'.
The reason that print is not yet implemented is that automatic
conversion between string values and other (e.g. numerical) values is not
yet implemented.
Assignment between arrays is not automatic. You have to use strcpy:
Awk: $1 = "foo"
Bawk: strcpy($1,"foo")
Redirection (printf "%s", $0 >file) is not implemented.
To match a field in awk you can say
$1 ~ /[Ff]oo/
in Bawk you say
match($1,@[Ff]oo@)
Arrays in Bawk are not associative. It would probably be a good idea to
remove the declarations from Bawk and to make type handling and array
handling more like awk.
Some minor changes:
Bawk can now take a command line pattern.
Here are three ways of invoking awk:
$ bawk @[Ff]oo@ file
$ echo >xxx @[Ff]oo@
$ bawk -f xxx file
$ bawk - file
@[Ff]oo@
$
The braindamaged parsing of command line arguments on the Amiga forced me
to define an alternative string delimiter. Strings can now be delimited
by '`' (`a string`) as well as '"' ("a string"). This behaviour is
optional. If you do not like it then undefine QUOTE_STRING_HACK in bawk.h.
I have used the Lattice C compiler. Conversion to manx with 32 bit ints
should be easy. The code assumes that sizeof(int) == sizeof(char *).
I used Fred Fish's dbug package to develop the current version. The name
dbug is a bit of a misnomer, 'trace' is a more appropriate name. dbug
implements tracing in an orderly manner. Very useful. The package is
available on Fish disk 41. An older version is on disk 2.
The trace code is conditionally compiled in depending on the definition
DBUG_OFF
To compile with tracing, comment out the definition of DBUG_OFF in bawk.h.
You can then invoke tracing and dbug printing with
bawk -\#t:d action file
Select printing only with
bawk -\#d action file
Note that bawk will run slower and be a bit larger if you compile with
tracing enabled.
Johan Widen
USENET: jw@sics.se